<template>
  <div>
    <detail-banner
    :sightName = 'sightName'
    :bannerImg = 'bannerImg'
    :bannerImgs = 'gallary'
    ></detail-banner>
    <detail-header></detail-header>
    <div class="content">
      <detail-list :list='list'></detail-list>
    </div>
  </div>
</template>

<script>
import DetailBanner from './components/banner'
import DetailHeader from './components/Header'
import DetailList from './components/List'
import axios from 'axios'
export default {
  name: 'detail',
  components: {
    DetailBanner,
    DetailHeader,
    DetailList
  },
  data () {
    return {
      list: [],
      sightName: '',
      bannerImg: '',
      gallary: []
    }
  },
  methods: {
    getInfoList () {
      // axios.get('/api/detail.json?id=' + this.$route.params.id),这是第一种写法
      // 下面是参数拼接的第二种写法
      axios.get('/api/detail.json', {
        params: {
          id: this.$route.params.id
        }
      }).then(this.getDateSuc)
    },
    getDateSuc (res) {
      this.list = res.data.list
      this.sightName = res.data.sightName
      this.bannerImg = res.data.bannerImg
      this.gallary = res.data.gallary
    }
  },
  mounted () {
    this.getInfoList()
  }
}
</script>

<style scoped>
.content{
  height: 800px;
}
</style>
